package com.wuage.interfaces.account.vo;

import com.wuage.domain.model.UacAccount;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wuage.infrastructure.utils.BeanUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author Shynin
 * @version 1.0
 * @date 2020-09-07 00:48
 */
@Data
@Builder
@ApiModel("用户信息")
@NoArgsConstructor
@AllArgsConstructor
public class AccountVO {

    @ApiModelProperty("id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;

    @ApiModelProperty("账号")
    private String username;

    @ApiModelProperty("昵称")
    private String nickname;

    @ApiModelProperty("是否启用")
    private Boolean enable;

    @ApiModelProperty("角色")
    private String role;

    @ApiModelProperty("邮箱")
    private String email;

    @ApiModelProperty("租户id")
    private Long tenantId;

    @ApiModelProperty("租户名字")
    private String tenantName;

    @ApiModelProperty("注册时间")
    private LocalDateTime createTime;

    @ApiModelProperty("更新时间")
    private LocalDateTime updateTime;

    @ApiModelProperty("是否删除")
    private Boolean deleted;

    public static AccountVO assembleAccount2VO(UacAccount item) {
        return BeanUtils.copyProperties(item, AccountVO.class);
    }

    public static List<AccountVO> assembleAccounts2Vos(List<UacAccount> accountList) {
        return BeanUtils.copyCollections(accountList, AccountVO.class);
    }
}
